var menus=[
    {
        "name": "租赁柜管理",
        "child": [
            {"name": "操作租赁柜", "url": "#user/cupboard/operation",interface:["ROLE_admin/addBox","ROLE_admin/deleteBox","ROLE_admin/findAll","ROLE_admin/EditfindById","ROLE_admin/findAllStore","ROLE_admin/relateStore","ROLE_admin/relateCpuIdAndCode","ROLE_admin/findLikdFranchise","ROLE_admin/findLikdMerchant"]},
            {"name": "消费数据", "url": "#user/cupboard/consumptionData",interface:["ROLE_admin/findAllConsumeData"]}
        ]
    },
    {
        "name": "客户管理",
        "child": [
            {"name": "操作加盟商", "url": "#user/customer/franchisee",interface:["ROLE_admin/deleteBusinessFranchise","ROLE_admin/updateBusinessFranchise","ROLE_admin/findFranchisee"]},
            {"name": "操作商户", "url": "#user/customer/tenant",interface:["ROLE_admin/addBusinessMerchant","ROLE_admin/deleteBusinessMerchant","ROLE_admin/updateBusinessMerchant","ROLE_admin/findMerchant","ROLE_admin/findItStoresApply","ROLE_admin/addStoreApply","ROLE_admin/EditBusinessFindById"]},
            {"name": "加盟申请", "url": "#user/customer/franchiseeApply",interface:["ROLE_admin/businessApplyPass","ROLE_admin/businessApplyFail","ROLE_admin/findBusinessApply","ROLE_admin/findItStore","ROLE_"]},
            {"name": "业绩数据", "url": "#user/customer/achievement",interface:["ROLE_admin/findAllDivide","ROLE_admin/findLikdBusiness","ROLE_admin/findDivideDetail"]}
        ]
    },
    {
        "name": "财务管理",
        "child": [
            {"name": "加盟商/商户提现审批", "url": "#user/finance/cash",interface:["ROLE_admin/findWithdrawal","ROLE_admin/handleCashCheck","ROLE_admin/handleCashPass","ROLE_admin/handleCashFinish","ROLE_admin/handleCashCancel","ROLE_/admin/findAllSysUser"]},

            {"name": "用户提现审批", "url": "#user/finance/cash",interface:["ROLE_admin/findWithdrawal","ROLE_admin/handleCashCheck","ROLE_admin/handleCashPass","ROLE_admin/handleCashFinish","ROLE_admin/handleCashCancel","ROLE_/admin/findAllSysUser"]},
            {"name": "分成设置", "url": "#user/finance/divide",interface:["ROLE_admin/findDivide","ROLE_admin/updateDivide","ROLE_admin/setStoreDivide","ROLE_admin/findExistDivide","ROLE_admin/findStoreInDivide"]},
            {"name": "用户押金管理", "url": "#user/finance/deposit",interface:["ROLE_admin/findTransaction","ROLE_admin/findThirdlyUsers"]},
            {"name": "商户押金管理", "url": "#user/finance/busDeposit",interface:["ROLE_admin/findThirdlyUserFund","ROLE_admin/findLikdBusiness"]},
            {"name": "充值数据", "url": "#user/finance/recharge",interface:["ROLE_admin/findAllPay"]},
            {"name": "用户电豆汇率", "url": "#user/finance/userRate",interface:["ROLE_admin/findYzdUserRateScheme","ROLE_admin/addYzdUserRateScheme","ROLE_admin/findOneYzdUserRateScheme","ROLE_admin/editYzdUserRateScheme","ROLE_admin/useYzdUserRateScheme","ROLE_admin/stopYzdUserRateScheme"]},
            {"name": "分成电豆汇率", "url": "#user/finance/businessRate",interface:["ROLE_admin/findYzdBusinessRateScheme","ROLE_admin/addYzdBusinessRateScheme","ROLE_admin/findOneYzdBusinessRateScheme","ROLE_admin/editYzdBusinessRateScheme","ROLE_admin/useYzdBusinessRateScheme","ROLE_admin/stopYzdBusinessRateScheme"]},
            {"name": "第三方用户", "url": "#user/finance/thirdlyUser",interface:["ROLE_admin/findDetailThirdlyUsers"]}
        ]
    },
    {
        "name": "客诉",
        "child": [
            {"name": "故障信息", "url": "#user/aftersale/faultInfo",interface:["ROLE_admin/findAllFaultInfo","ROLE_admin/findException","ROLE_admin/findOneException","ROLE_admin/finishHandle"]}
        ]
    },
    {
        "name": "推广设置",
        "child": [
            {"name": "关注奖励设置", "url": "#user/spread/attention",interface:["ROLE_admin/findSubscribedAward","ROLE_admin/setSubscribedAward","ROLE_admin/addSubscribedAward","ROLE_admin/findSubscribedAwardById","ROLE_admin/editSubscribedAward"]},
            {"name": "推荐奖励设置", "url": "#user/spread/recommend",interface:["ROLE_admin/findSuggestedFollows","ROLE_admin/setSuggestedFollows","ROLE_admin/addSuggestedFollows","ROLE_admin/findSuggestedFollowsById","ROLE_admin/editSuggestedFollows"]},
            {"name": "计费方案设置", "url": "#user/spread/chargePlan",interface:["ROLE_admin/findChargingScheme","ROLE_admin/setChargingScheme","ROLE_admin/addChargingScheme","ROLE_admin/findChargingSchemeById","ROLE_admin/editChargingScheme"]},
            {"name": "押金设置", "url": "#user/spread/Pledge",interface:["ROLE_admin/findAllPledgeScheme","ROLE_admin/addPledgeScheme","ROLE_admin/findAllPledgeSchemeById","ROLE_admin/editPledgeScheme","ROLE_admin/usePledgeScheme"]}
        ]
    },
    {
        "name": "优惠设置",
        "child": [
            {"name": "购买电豆优惠", "url": "#user/discount/buyBean",interface:["ROLE_admin/findPayYzdScheme","ROLE_admin/addPayYzdScheme","ROLE_admin/editPayYzdScheme","ROLE_admin/usePayYzdScheme","ROLE_admin/stopPayYzdScheme","ROLE_admin/findOnePayYzdScheme"]},
            {"name": "充值优惠", "url": "#user/discount/recharge",interface:["ROLE_admin/findPayScheme","ROLE_admin/addPayScheme","ROLE_admin/editPayScheme","ROLE_admin/usePayScheme","ROLE_admin/stopPayScheme","ROLE_admin/findOnePayScheme"]}
        ]
    },
    {
        "name": "升级管理",
        "child": [
            {"name": "上传升级包", "url": "#user/upgrade/upload",interface:["ROLE_admin/upadtePackUpload"]}
        ]
    },
    {
        "name": "系统设置",
        "child": [
            {"name": "用户权限", "url": "#user/system/userPower",interface:["ROLE_admin/findAllSysUser","ROLE_admin/findSysUserRoleById","ROLE_admin/findSysUserRoleById"]},
            {"name": "角色权限", "url": "#user/system/rolePower",interface:["ROLE_admin/findAllRole","ROLE_admin/addRole","ROLE_admin/findallSysResourceRole","ROLE_admin/findresourceRolesById","ROLE_admin/updateRole"]},
            {"name": "用户列表", "url": "#user/system/userList",interface:["ROLE_admin/findAllSysUser","ROLE_admin/deleteSysUser","ROLE_admin/userSysUser","ROLE_admin/stopSysUser","ROLE_admin/addSysUser"]},
            {"name": "修改密码", "url": "#user/system/resetPassword",interface:["ROLE_admin/retsetPassword"]},
            {"name": "客服电话", "url": "#user/system/servicePhone",interface:["ROLE_admin/findServicePhone","ROLE_admin/setServicePhone"]}
        ]
    }
]
var id=1
var gens=[]
var r=[]
var mr=[]
var mn=[]
for(var i in menus){
    var f=i*1+1
    var menu=menus[i]
    var s1="var m"+i+"=menuDaoI.save(SysMenu(name =\""+menu.name+"\",url = \"\",remark = \""+menu.name+"\",parentId = 0,forder="+(f*100)+" ))\n"
    var m="m"+i
    mn.push(m)
    gens.push(s1)
    if(menu.child){
        for(var k in menu.child){
            var m2=menu.child[k]
            var s2="var m"+i+"_"+k+"=menuDaoI.save(SysMenu(name =\""+m2.name+"\",url = \""+m2.url+"\",remark = \""+m2.name+"\",parentId = m"+i+".id ,forder="+((f*100)+(k*1+1))+"))\n"
            gens.push(s2)
            mn.push("m"+i+"_"+k)
            if(m2.interface&&m2.interface.length>0){
                var r1="menuInterfaceDaoI.save(m"+i+"_"+k+".id, mutableSetOf(\""+m2.interface.join("\",\"")+"\"))\n"
                r.push(r1)
            }
        }
    }
}

console.log(gens.join(""))
console.log(r.join(""))
console.log("var allMenus=mutableSetOf("+mn.join(".id,")+")")